/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sandbox.com.test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Properties;
import sandbox.WadsConfigDialog;
import wads.com.WADTools;

/**
 *
 * @author Nattasan W.
 */
public class FreeRun {

    public FreeRun() {
        testDateClass();
    }

    private void testDateClass() {
        Date date = new Date();
        DateFormat format = DateFormat.getDateInstance(DateFormat.LONG, Locale.US);
//        System.out.println(format.format(date));
        File form = new File(WADTools.FORM_PATH);
        System.out.println(System.getenv("APPDATA"));
    }

    private void createConfigFile() {
        try {
            File configfile = new File("res/sys/config.prop");
            if(!configfile.exists()) {
                configfile.createNewFile();
            }

            Properties config = new Properties();

            config.setProperty(WadsConfigDialog.WEB_SERVER_URL_KEY, "http://localhost:8084/WADSWeb/");
            config.setProperty(WadsConfigDialog.SERVLET_ACTION_URL_KEY, "servlet/submitForm");

            config.setProperty(WadsConfigDialog.CURRENT_DB_TYPE_KEY, "internet");

            config.setProperty(WadsConfigDialog.LOCAL_DB_URL_KEY, "localhost:1527/");
            config.setProperty(WadsConfigDialog.LOCAL_DB_USERNAME_KEY, "admin");
            config.setProperty(WadsConfigDialog.LOCAL_DB_PASSWORD_KEY, "admin");

            config.setProperty(WadsConfigDialog.EMBEDDED_DB_URL_KEY, "database/WadsDB");
            config.setProperty(WadsConfigDialog.EMBEDDED_DB_USERNAME_KEY, "admin");
            config.setProperty(WadsConfigDialog.EMBEDDED_DB_PASSWORD_KEY, "admin");

            config.setProperty(WadsConfigDialog.INTERNET_DB_URL_KEY, "db4free.net:3306/");
            config.setProperty(WadsConfigDialog.INTERNET_DB_USERNAME_KEY, "xenogew");
            config.setProperty(WadsConfigDialog.INTERNET_DB_PASSWORD_KEY, "widwacom");

            config.setProperty(WadsConfigDialog.REMEMBER_PASSWORD_KEY, "yes");

            config.store(new FileOutputStream(configfile), "WADS' Configuration.");
        }
        catch(IOException ex) {
            ex.printStackTrace();
        }
    }

    public static void main(String args[]) {
        new FreeRun();
    }
}
